package edu.xhu.biliuser.service.impl;

import edu.xhu.biliuser.mapper.BiliUserMapper;
import edu.xhu.biliuser.service.BiliUserCrudService;
import edu.xhu.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@RequiredArgsConstructor
@Slf4j
public class BiliUserCrudServiceImpl implements BiliUserCrudService {

    private final BiliUserMapper biliUserMapper;

    /**
     * 获取全部用户id
     *
     * @return
     */
    @Override
    public ResponseResult<?> getAllUserIds() {
        List<Long> userIds = biliUserMapper.getAllUserIds();

        //判空逻辑
        if (userIds == null)
            userIds = new ArrayList<>();

        return ResponseResult.okResult(userIds);
    }
}
